<template>
  <div class="aboutus" ref="fullHomePage">
    <nav-top title="我的账户" :goback="true"></nav-top>
    <div class="content">
      <div class="list" @click="memberBTN">
        <span >会员状态</span>
        <van-icon style="float:right" name="arrow" />
        <button>  {{ member.grade != 0 ? "会员主页": "购买会员" }}</button>
        <span class="status"> {{ member.grade == 1 ? "银卡会员": member.grade == 2 ? "金卡会员": member.grade == 3 ? "钻石会员": "普通会员"}} </span>
      </div>
      <div class="list" @click="teamBTN">
        <span>我的团队</span>
        <van-icon style="float:right" name="arrow" />
        <button >{{"查看详情"}}</button>
        <span class="price">¥{{ member.cash/100 }}</span>
      </div>
      <div class="list" @click="pointBTN">
        <span>当前积分</span>
        <van-icon style="float:right" name="arrow" />
        <span class="integral">{{ member.point }}</span>
      </div>
      <div class="list" @click="consultdoctorBTN" v-show="member.grade != 0 ? true:false">
        <span>免费询医次数</span>
        <van-icon style="float:right" name="arrow" />
        <span class="integral">{{ consult_doctor_member.free_count }}</span>
      </div>
      <div class="list" @click="hospitalspecialistBTN" v-show="member.grade != 0 ? true:false">
        <span>免费专科预约次数</span>
        <van-icon style="float:right" name="arrow" />
        <span class="integral">{{ hospital_specialist_member.free_count }}</span>
      </div>
      <div class="list" @click="underwriterBTN" v-show="member.grade != 0 ? true:false">
        <span>免费人工核保次数</span>
        <van-icon style="float:right" name="arrow" />
        <span class="integral">{{ underwriter_member.free_count }}</span>
      </div>
    </div>
  </div>
</template>

<script>
import NavTop from "@/components/nav/navBar";
import areaList from "@/common/area";
import axios from 'axios';
import { domain } from '../../api';
export default {
  components: {
    NavTop
  },
  methods:{
    pointBTN() {
      window.location.href = '/user/point'
    },
    memberBTN () {
      window.location.href = '/user/member'
    },
    teamBTN () {
      window.location.href = '/user/team'
    },
    consultdoctorBTN (){
      // 咨询医生
      window.location.href = '/consultdoctor'
    },
    underwriterBTN (){
      // 人工核保
      window.location.href = '/underwriter'
    },
    hospitalspecialistBTN (){
      // 专科预约
      window.location.href = '/hongkong/hospital'
    },
    changeFixed(clientHeight) {
      console.log(clientHeight);
      this.$refs.fullHomePage.style.height = clientHeight + "px";
    },
    confirm(val) {
      this.selectArea = val;
      this.show = false;
    }
  },
  data() {
    return {
      member:{
      },
      underwriter_member:{

      },
      hospital_specialist_member:{
        
      },
      consult_doctor_member:{

      }

    };
  },
  created(){
    axios.get(domain+'/api/member/info')
    .then((res)=>{
      if(res.data.code == 1 ){
        this.member = res.data.data
      }else{
        this.$dialog.alert({ title: res.data.msg, message: res.data.err })
      }
    })
    .catch((err)=>{
      this.$dialog.alert({ title: '提示', message: err })
    })
    // 人工核保
    axios.get(domain+'/api/underwriter/query/receive/freecount')
    .then((res)=>{
      if(res.data.code == 1 ){
        this.underwriter_member = res.data.data
      }else{
        this.$dialog.alert({ title: res.data.msg, message: res.data.err })
      }
    })
    .catch((err)=>{
      this.$dialog.alert({ title: '提示', message: err })
    })
    // 咨询医生
    axios.get(domain+'/api/consultdoctor/query/receive/freecount')
    .then((res)=>{
      if(res.data.code == 1 ){
        this.consult_doctor_member = res.data.data
      }else{
        this.$dialog.alert({ title: res.data.msg, message: res.data.err })
      }
    })
    .catch((err)=>{
      this.$dialog.alert({ title: '提示', message: err })
    })
    // 专科预约
    axios.get(domain+'/api/hospitalspecialist/query/receive/freecount')
    .then((res)=>{
      if(res.data.code == 1 ){
        this.hospital_specialist_member = res.data.data
      }else{
        this.$dialog.alert({ title: res.data.msg, message: res.data.err })
      }
    })
    .catch((err)=>{
      this.$dialog.alert({ title: '提示', message: err })
    })
  },
  mounted() {
    this.clientHeight = `${document.documentElement.clientHeight}`;
    window.onresize = function temp() {
      this.clientHeight = `${document.documentElement.clientHeight}`;
    };
  },
  watch: {
    clientHeight: function() {
      this.changeFixed(this.clientHeight);
    }
  },
};
</script>

 <style lang="scss" scoped>
.aboutus {
  background: #f5f5f7;
  .content {
    padding-top: 42px;
    background: #f5f5f7;
    .list {
      height: 36px;
      width: 320px;
      background: #fff;
      margin-bottom: 3px;
      span {
        padding-left: 11px;
        font-size: 13px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(33, 33, 33, 1);
        line-height: 36px;
      }
      i:before {
        padding-right: 13px;
        line-height: 36px;
        color: #cdcdcd;
      }

      .status,
      .price,
      .integral {
        float: right;
        font-size: 11px;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(102, 102, 102, 1);
        line-height: 36px;
        margin-right: 13px;
      }
      .price {
        color: rgba(6, 164, 79, 1);
      }
      button {
        float: right;
        width: 56px;
        padding: 0;
        height: 22px;
        // border: 1px rgb(27, 23, 23) d rgba(6, 164, 79, 1);
        border: 1px solid #06A44F;
        border-radius: 4px;
        font-size: 10px !important;
        font-family: Microsoft YaHei;
        font-weight: 400;
        color: rgba(6, 164, 79, 1);
        margin-top: 7px;
        background: #fff;
        margin-right: 11px;
      }
    }
  }
}
</style>
